load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("scm_server_infra")

rust_library(
    name = "blobsync",
    srcs = glob(["blobsync/src/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "blobsync"},
    test_deps = [
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:futures",
        "//common/rust/shed/borrowed:borrowed",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/fbinit:fbinit-tokio",
        "//eden/mononoke/blobstore:memblob",
        "//eden/mononoke/blobstore:redactedblobstore",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
    ],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/repo_attributes/filestore:filestore",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/server/context:context",
    ],
)

rust_library(
    name = "blobrepo_errors",
    srcs = glob(["errors/src/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "errors"},
    deps = [
        "fbsource//third-party/rust:ascii",
        "fbsource//third-party/rust:thiserror",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/mononoke_types:mononoke_types",
    ],
)

rust_library(
    name = "blobrepo_hg",
    srcs = glob(["blobrepo_hg/src/**/*.rs"]),
    autocargo = {
        "cargo_toml_dir": "blobrepo_hg",
    },
    test_deps = [
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:maplit",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/fbinit:fbinit-tokio",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/repo_factory:test_repo_factory",
        "//eden/mononoke/tests/utils:tests_utils",
    ],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:async-trait",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:uuid",
        ":blobrepo_common",
        ":blobrepo_errors",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/futures_ext:futures_ext",
        "//common/rust/shed/futures_stats:futures_stats",
        "//common/rust/shed/sorted_vector_map:sorted_vector_map",
        "//common/rust/shed/stats:stats",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/derived_data/mercurial_derivation:mercurial_derivation",
        "//eden/mononoke/manifest:manifest",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/repo_attributes/bonsai_hg_mapping:bonsai_hg_mapping",
        "//eden/mononoke/repo_attributes/bookmarks:bookmarks",
        "//eden/mononoke/repo_attributes/commit_graph/commit_graph:commit_graph",
        "//eden/mononoke/repo_attributes/filenodes:filenodes",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_derived_data:repo_derived_data",
        "//eden/mononoke/server/context:context",
    ],
)

rust_library(
    name = "blobrepo_override",
    srcs = glob(["override/src/**/*.rs"]),
    autocargo = {
        "cargo_toml_dir": "override",
    },
    deps = [],
)

rust_library(
    name = "blobrepo_common",
    srcs = glob(["common/src/**/*.rs"]),
    autocargo = {
        "cargo_toml_dir": "common",
    },
    test_deps = ["//eden/mononoke/mononoke_macros:mononoke_macros"],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:maplit",
        "fbsource//third-party/rust:thiserror",
        "fbsource//third-party/rust:tracing",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/stats:stats",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/manifest:manifest",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/repo_attributes/bonsai_hg_mapping:bonsai_hg_mapping",
        "//eden/mononoke/repo_attributes/commit_graph/commit_graph:commit_graph",
        "//eden/mononoke/repo_attributes/filenodes:filenodes",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/mononoke/server/context:context",
    ],
)
